import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}esopInfo/export`;
// 分页查询
export function getList (params = {}) {
  return request({
    url: `${mesUrl}esopInfo/page`,
    method: "get",
    params,
  });
}
// 新增
export function rowCreate (data = {}) {
  return request({
    url: `${mesUrl}esopInfo`,
    method: "post",
    data,
  });
}
// 修改
export function rowUpdate (data = {}) {
  return request({
    url: `${mesUrl}esopInfo`,
    method: "put",
    data,
  });
}
// 删除
export function rowDel (id) {
  return request({
    url: `${mesUrl}esopInfo/d/${id}`,
    method: "post",
  });
}
// 详情
export function rowDetail (id) {
  return request({
    url: `${mesUrl}esopInfo/info/${id}`,
    method: "get",
  });
}
// 根据工位获得工序和工位的关系
export function getListByWorkCellCode (workCellCode) {
  return request({
    url: `${mesUrl}mesProcessCell/getListByWorkCellCode/${workCellCode}`,
    method: "get",
  });
}

// 导入用户
export function importData (data = {}) {
  return request({
    url: `${mesUrl}esopInfo/import`,
    method: "POST",
    data,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
}
// 下载模板
export const downloadTemplateUrl = `${mesUrl}esopInfo/template`;

// 查询线体列表
export function getLineCodeList (params) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}

// 查询工位编码列表
export function getStationCodeList (params) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}
// 查询工装冶具列表
export function getFrockList (params) {
  return request({
    url: `${adminUrl}commonExtensionFrock`,
    method: "get",
    params,
  });
}

// 图片查询
export function coFile (id) {
  return request({
    url: `${mesUrl}coFile/view/${id}`,
    method: "get",
  });
}
